<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>旅游度假信息管理</title>
<%@include file="../header.jsp" %>
<!-- ueditor -->
<script type="text/javascript" src="/ueditor/ueditor.config.js"></script>
<script type="text/javascript" src="/ueditor/ueditor.all.js"></script>

<!-- my97datepicker -->
<script type="text/javascript" src="/My97DatePicker/WdatePicker.js"></script>

<!-- jquery fileupload -->
<script type="text/javascript" src="/js/vendor/jquery.ui.widget.js"></script>  
<script type="text/javascript" src="/js/jquery.iframe-transport.js"></script>  
<script type="text/javascript" src="/js/jquery.fileupload.js"></script>
<link rel="stylesheet" href="/css/jquery.fileupload.css">
<script type="text/javascript">
	function turnpage(page) {
		query(page);
	}
	
	function query(page) {
		var param = {
			name:$("#name").val(),
			DictionaryId:$("#DictionaryId").val(),
			fullAddress:$("#fullAddress").val()
		}
		if(page!=null) {
			param.pageNo = page; 
		}
		$.ajax({
			url:"/scene/query.htm",
			type:"post",
			data:param,
			dataType:"html"
		}).done(function(data){
			$("#scene-table").html(data);
		})
	}
	
	function selectScene() {
		$('#scene-dialog').modal('show');
	}
	
	function addview() {
		/* var li = "<li><a id='edit-line-tab' class='taba' href='#edit-panel'>票品编辑</a></li>";
		$("#line-tab").append(li);
		$("#edit-line-tab").tab("show"); */
		$(".line-index-div").hide();
		$(".line-index-div:eq(1)").show();
	}
	
	function remove() {
		
	}
	
	function setRelatedline() {
		$('#line-dialog').modal('show');
	}
	
	function setRelatedProduct() {
		
	}
	
	function jumpRelation(id) {
		$(".line-index-div").hide();
		$(".line-index-div:eq(2)").show();
	}
	
	function selectMorelines() {
		$(".line-index-div").hide();
		$(".line-index-div:eq(3)").show();
		$("#relation-line-table").find("tbody").load("/line/listdata.htm");
	}
	
	function selectMoreLines() {
		$(".line-index-div").hide();
		$(".line-index-div:eq(4)").show();
		$("#relation-line-table").find("tbody").load("/line/listdata.htm");
	}
	
	function relatelineConfirm() {
		
		var checks = $("#relation-line-table").find("input[name='line_id']");
		var checkIds = checks.map(function(i, n){
			if(n.checked==true) return n.value;
		}).get().join(",");
		
		$.ajax({
			url:"/line/loaddatas.htm?ids="+checkIds,
			dataType:"html"
		}).done(function(data){
			$("#relation-index-line-table").find("tbody").append(data);
		})
		
		$(".line-index-div").hide();
		$(".line-index-div:eq(2)").show();
	}
	
	function relateLineConfirm() {
		var checks = $("#relation-line-table").find("input[name='line_id']");
		var checkIds = checks.map(function(i, n){
			if(n.checked==true) return n.value;
		}).get().join(",");
		
		$.ajax({
			url:"/line/loaddatas.htm?ids="+checkIds,
			dataType:"html"
		}).done(function(data){
			$("#relation-index-line-table").find("tbody").append(data);
		})
		
		$(".line-index-div").hide();
		$(".line-index-div:eq(2)").show();
	}
	
	function jsDel(a) {
		if(confirm("确定要删除么？")) {
			alert("删除成功！！");
			$(a).parent().parent().remove();
		}
	}
	
    $(function () { 
      //$('#line a:last').tab('show');//初始化显示哪个tab 
    	
      	$(document).on('click', '.taba', function(e) {
        	e.preventDefault();//阻止a链接的跳转行为 
        	$(this).tab('show');//显示当前选中的链接及关联的content 
        });
      
      	$(document).on("mouseenter", 'ul.gallery li', function () {
            $('img', this).fadeToggle(1000);
            $(this).find('.gallery-controls').remove();
            $(this).append('<div class="well gallery-controls">' +
                '<p><a href="javascript:;" class="gallery-delete btn"><i class="glyphicon glyphicon-remove"></i></a></p>' +
                '</div>');
            $(this).find('.gallery-controls').stop().animate({'margin-top': '-1'}, 400);
        });
        
      	$('.thumbnails').on('click', '.gallery-delete', function (e) {
            e.preventDefault();
            //get image id
            //alert($(this).parents('.thumbnail').attr('id'));
            //$(this).parents('.thumbnail').fadeOut();
            $(this).parents('.thumbnail').remove();
        });
      	
        $(document).on("mouseleave", 'ul.gallery li', function () {
            $('img', this).fadeToggle(1000);
            $(this).find('.gallery-controls').stop().animate({'margin-top': '-30'}, 200, function () {
                $(this).remove();
            });
        });
      
      	$("#line-img-upload").fileupload({  
    	    url:"/common/upload.htm",//文件上传地址，当然也可以直接写在input的data-url属性内  
    	    formData:{type:"line"},//如果需要额外添加参数可以在这里添加  
    	    done:function(e,data){  
    	        //done方法就是上传完毕的回调函数，其他回调函数可以自行查看api  
    	        //注意result要和jquery的ajax的data参数区分，这个对象包含了整个请求信息  
    	        //返回的数据在result.result中，假设我们服务器返回了一个json对象  
    	        //console.log(JSON.stringify(result.result)); 
    	        var ret = eval("("+data.result+")");
    	        if(ret.isSuccess) {
    	        	var li = "<li class='thumbnail'><a style='background:url("+ret.json.url+")'><img"+
                    "class='grayscale' src='"+ret.json.url+"'></a></li>";
    	        	$(".thumbnails").append(li);
    	        } 
    	    }  
    	}) 
    	
    	$("#savebtn").click(function() {
    		//ajax
    		/* $("#edit-line-tab").parent().remove();
    		$("#list-line-tab").tab("show"); */
    		$(".line-index-div").hide();
    		$(".line-index-div:eq(0)").show();
    	})
    	
    	//var ue1 = UE.getEditor('desc_editor',{initialFrameWidth:900});
    	//var ue2 = UE.getEditor('buynote_editor',{initialFrameWidth:900});
    }) 
</script>
</head>
<body>
	<%-- <ul class="nav nav-tabs" id="line-tab"> 
      <li class="active"><a id="list-line-tab" class="taba" href="#list-panel">票品列表</a></li> 
    </ul> 
       
    <div class="tab-content"> 
      <div class="tab-pane active" id="list-panel">
      	<jsp:include page="list.jsp"/>
      </div> 
      <div class="tab-pane" id="edit-panel">
      	<jsp:include page="add.jsp"/>
      </div>
    </div> --%>
    <div class="line-index-div"><jsp:include page="list.jsp"/></div>
    <%-- <div class="line-index-div" style="display:none;"><jsp:include page="add.jsp"/></div> --%>
    <div class="line-index-div" style="display:none;"><jsp:include page="../relation/index.jsp"/></div>
    <div class="line-index-div" style="display:none;"><jsp:include page="../relation/line.jsp"/></div>
    <div class="line-index-div" style="display:none;"><jsp:include page="../relation/line.jsp"/></div>
    
    <jsp:include page="../scene/dialog.jsp"/>   
</body>
</html>